import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/Layout'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect:"/home",
    children:[
      {
        path:'/home',
        name:'Home',
        component: () =>import("../views/Home")
      },
      {
        path: '/user',
        name: 'User',
        component: () => import("../views/User")
      },
      {
        path: '/person',
        name: 'Person',
        component: () => import("../views/Person")
      },
      {
        path: '/cabinet',
        name: 'Cabinet',
        component: () => import("../views/Cabinet")
      },
      {
        path: '/admin',
        name: 'Admin',
        component: ()=> import("../views/Admin")
      },
      {
        path: '/box',
        name: 'Box',
        component: ()=> import("../views/Box")
      },
      {
        path: "/news",
        name: "News",
        component: () => import("../views/News")
      },
      {
        path: "/useShare",
        name: "UseShare",
        component: () => import("../views/UseShare")
      },
      {
        path: "/history",
        name: "History",
        component:() => import("../views/History")
      }

    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import("../views/Login")
  },
  {
    path: "/register",
    name: "Register",
    component: () => import("../views/Register")
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
